package com.lind.kickoffki.awt;

import java.awt.Point;
import java.awt.Rectangle;

import kickoff.logic.IPoint;
import kickoff.logic.IRectangle;

public class AWTRectangle implements IRectangle {

	Rectangle rect;

	public AWTRectangle(int x, int y, int b, int h) {
		rect = new Rectangle(x, y, b, h);
	}

	@Override
	public void setX(int x) {
		rect.setLocation(x, (int)rect.getY());
	}

	@Override
	public void setY(int y) {
		rect.setLocation((int)rect.getY(), y);
	}

	@Override
	public int getHeight() {
		return (int)rect.getHeight();
	}

	@Override
	public int getWidth() {
		return (int)rect.getWidth();
	}

	@Override
	public int getX() {
		return (int)rect.getX();
	}

	@Override
	public int getY() {
		return (int)rect.getY();
	}

	@Override
	public void setWidth(int w) {
		rect.setSize(w, (int)rect.getHeight());
	}

	@Override
	public void setHeight(int h) {
		rect.setSize((int)rect.getWidth(), h);
	}

	public boolean contains(IPoint p) {
		return rect.contains(new Point((int)p.getX(), (int)p.getY()));
	}

}
